package com.jikexueshe.crm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jikexueshe.crm.mapper.CDeptMapper;
import com.jikexueshe.crm.pojo.CDept;
import com.jikexueshe.crm.service.DeptService;

@Service
public class DeptServieImpl implements DeptService {
	
	@Autowired
	private CDeptMapper deptMapper;

	@Override
	public void save(CDept t) {
		deptMapper.insert(t);
	}

	@Override
	public void delete(Integer id) {
		deptMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(CDept t) {
		deptMapper.updateByPrimaryKey(t);
	}

	@Override
	public PageInfo<CDept> select(Integer page,Integer rows,CDept t) {
		PageHelper.startPage(page,rows);
		List<CDept> list = deptMapper.select(t);
		return new PageInfo(list);
	}

	@Override
	public CDept getById(Integer id) {
		return deptMapper.selectByPrimaryKey(id);
	}

}
